const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MyPlugin = require('./plugins/my-plugin')

module.exports = {
    mode: 'development',
    entry: './src/index.js',

    output:{
        path:path.resolve(__dirname,'dist'),
        filename:'bundle.js'
    },

    // 解析自定义loader
    resolveLoader: {
        modules: [
            path.resolve(__dirname, 'loaders')  // 自定义loader的目录位置,下面才可以使用
        ]
    },

    module:{
        rules:[
            {
                test: /\.css$/i,
                use: 'my-style-loader'
            }
        ]
    },

    // 插件配置
    plugins: [
        new HtmlWebpackPlugin({
            template: 'index.html'   // 页面模板
        }),
        new MyPlugin()
    ],

}